li r4, 0

li r5, 4		//size of matrix (box)
li r6, 0
li	r6, 20	//base address of A
li r7, 0
li	r7, 100	//base address of B
li r8,0
li	r8, 120	//base address of C
		
li	r1, 0		//init i=0
begina:
mv r15,r5
sub r15, r1	
blez r15, endloopa		//if i>=box goto loopa
	
	li	r2, 0		//j=0
	beginb:	
        mv r15,r5
	sub r15,r2	
	blez r15, endloopb	//if j>=box goto loopb
	
mv r15,r1	
mul r15, r5
add r15, r2
mv r14, r15
add r14, r6
store r1, 0(r14)
mv r14,r15
add r14, r7
store r2, 0(r14)

		addi	r2, 1		//j++
		bez r0, beginb			//start loopb again
	endloopb:	
	
	addi	r1, 1		//i++
	bez r0, begina			//start loopa again
endloopa:	



li	r1, 0		//init i=0
loop1:
mv r15,r5
sub r15, r1	
blez r15, endloop1		//if i>=box goto loopa
	
	li	r2, 0		//j=0
	loop2:	
mv r15,r5
sub r15,r2
blez r15, endloop2	//if j>=box goto loopb
	

li r4,0		//var = 0

		li	r3,  0		//temp=0
		loop3:	
		mv r15,r5
		sub r15, r3	
		blez r15, endloop3	//if temp>=box goto loop3end
		
mv r15,r1	
mul r15,r5
add r15, r3
mv r14,r15
add r14, r6

load r10, 0(r14) // A[i][temp]

mv r15,r3
mul r15, r5
add r15, r2
mv r14,r15
add r14, r7
load r11, 0(r14) // B[temp][j]

			mul r10, r11

			add r4, r10		//var = var + r10*r11

			addi	r3,  1		//temp++
			bez r0, loop3			//start loop3 again
		endloop3:	

mv r15,r1
mul r15, r5
add r15, r2
mv r14,r15	
add r14,r8
store r4, 0(r14)	//C[i][j] = var

		addi	r2, 1		//j++
		bez r0, loop2			//start loopb again

	endloop2:	
	
	addi	r1,  1		//i++
	bez r0, loop1			//start loopa again
endloop1:	